<h2 translate>System Startup</h2>

<uib-tabset>
	<uib-tab heading="{{'Init Scripts' | translate}}">
		<table class="table table-striped">
			<tr class="cbi-section-table-titles">
				<th translate translate-context="Init scripts">Start priority</th>
				<th translate translate-context="Init scripts">Name</th>
				<th translate translate-context="Init scripts">Enabled?</th>
				<th translate translate-context="Init scripts">Actions</th>
			</tr>
			<tr ng-repeat="initScript in View.initList">
				<td style="width:5%">{{initScript.start >= 0 ? initScript.start : initScript.stop}}</td>
				<td>{{initScript.name}}</td>
				<td style="width:1%">
					<button ng-if="initScript.enabled" ng-click="View.callInitAction(initScript.name, 'disable')" type="button" class="btn btn-sm btn-success" translate>Enabled</button>
					<button ng-if="!initScript.enabled" ng-click="View.callInitAction(initScript.name, 'enable')" type="button" class="btn btn-sm btn-danger" translate>Disabled</button>
				</td>
				<td style="width:1%">
					<div class="btn-group" uib-dropdown>
						<button class="btn btn-primary btn-sm uib-dropdown-toggle" uib-dropdown-toggle translate>Action…</button>
						<ul class="dropdown-menu pull-right">
							<li><a href="#" ng-click="View.callInitAction(initScript.name, 'start'); $event.preventDefault()">
								<span translate translate-context="Init action">Start</span>
							</a></li>
							<li><a href="#" ng-click="View.callInitAction(initScript.name, 'stop'); $event.preventDefault()">
								<span translate translate-context="Init action">Stop</span>
							</a></li>
							<li><a href="#" ng-click="View.callInitAction(initScript.name, 'restart'); $event.preventDefault()">
								<span translate translate-context="Init action">Restart</span>
							</a></li>
						</ul>
					</div>
				</td>
			</tr>
		</table>
	</uib-tab>
	<uib-tab heading="{{'Local Startup' | translate}}">
		<p translate>This is the content of /etc/rc.local. Insert your own commands here (in front of 'exit 0') to execute them at the end of the boot process.</p>

		<textarea class="form-control" rows="20" ng-model="View.rclocal"></textarea><br>

		<div class="alert alert-success" ng-show="View.isRcLocalChanged">
			<button type="button" class="close" ng-click="View.isRcLocalChanged = false">&times;</button>
			<translate>The local startup script has been updated.</translate>
		</div>

		<div class="panel panel-default panel-body text-right">
			<button ng-click="View.changeRcLocal()" translate type="button" class="btn btn-primary">Apply</button>
		</div>
	</uib-tab>
</uib-tabset>
